package com.hiwhitley.easy.day19;

import com.hiwhitley.base.TreeNode;

/**
 * Created by hiwhitley on 2016/9/18.
 */
public class PathSum_112 {
    public boolean hasPathSum(TreeNode root, int sum) {
        if (root == null)
            return false;
        if (root.left == null && root.right == null && root.val == sum)
            return true;
        else
            return hasPathSum(root.left, sum - root.val) || hasPathSum(root.right, sum - root.val);

    }
}
